/**
 * Copyright (C), 2015-2018, XXX有限公司
 * FileName: LogFactory
 * Author:   zhouheng
 * Date:     2018/7/10 22:38
 * Description: 日志工厂
 * History:
 * <author>          <time>          <version>          <desc>
 * 作者姓名           修改时间           版本号              描述
 */
package com.hengby.hengcrud.core.log.factory;

import com.hengby.hengcrud.core.common.status.LogType;
import com.hengby.hengcrud.core.constants.LogSucceed;
import com.hengby.hengcrud.modular.sys.model.OperationLog;

import java.util.Date;

/**
 * 〈一句话功能简述〉<br> 
 * 〈日志工厂〉
 *
 * @author zhouheng
 * @create 2018/7/10
 * @since 1.0.0
 */
public class LogFactory {

    public static OperationLog createOperationLog(LogType logType, Integer userId,
                                                  String bussinessName, String clazzName,
                                                  String methodName, String msg, LogSucceed success) {
        OperationLog operationLog = new OperationLog();
        operationLog.setLogtype(logType.getMessage());
        operationLog.setLogname(bussinessName);
        operationLog.setUserid(userId);
        operationLog.setClassname(clazzName);
        operationLog.setMethod(methodName);
        operationLog.setCreatetime(new Date());
        operationLog.setSucceed(success.getMessage());
        operationLog.setMessage(msg);

        return operationLog;
    }
}